<?php

	$params = split('/', $this->getParams());
	$num_per_page = 10;
	if(is_numeric($params[1]))
	{
		$offset = ($params[1] - 1);
	}
	else
	{
		$offset = 0;
	}
	$posts = PostMapper::get()->findBySearchTerm($params[0], $offset * $num_per_page, $num_per_page);
	$this->view()->assign('template', 'home.tpl');
	$this->view()->assign('posts', $posts);
	$this->view()->assign('section', 'search/' . $params[0]);

	$post_plugin = Plugin::load('post', true);
	$this->view()->assignRef('post_plugin', $post_plugin);
	
	$this->addInclude('app/css/areas/home.css','css');
	
?>